﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using IMeem.BO;

namespace IMeem.Model
{
    public class Instances
    {
        private ObservableCollection<SearchResult> _searchResults;
        private IMeem.API.IMeem _imeem;

        public IMeem.API.IMeem Imeem
        {
            get { return _imeem; }
        }

        public ObservableCollection<SearchResult> SearchResults 
        {
            get
            {
                return _searchResults;
            }
            set
            {
                _searchResults = value;
            }
        }

        public Instances()
        {
            _searchResults = new ObservableCollection<SearchResult>();
            //_searchResults.Add(new SearchResult() { Title="toto'song", Album="toto's album", Artist="toto", Year=2008, Picture="http://www.babble.com/CS/blogs/famecrawler/2009/02/salma-hayek-cleavage-breastfeeding-.jpg"});
            _imeem = new IMeem.API.IMeem();
        }

        public void Search(string subject)
        {
            _searchResults.Clear();
            List<SearchResult> results = _imeem.Search(subject,true);
            foreach (SearchResult result in results)
                _searchResults.Add(result);
        }
    }
}
